package com.expense.services.expensesInfo;

import java.io.IOException;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.expense.entity.ExpensesDetailsInfo;
import com.expense.entity.ExpensesInfo;
import com.expense.entity.TeamInfo;
import com.expense.entity.UserInfo;
import com.expense.services.BasicServices;
import com.expense.util.Constants;
import com.expense.util.PaginatedList;

/**
 * 费用信息 Services类
 * @author xj
 * */
public class ExpensesInfoServices extends BasicServices{
	
	/**
	 * 查询费用信息列表
	 * @throws IOException 
	 * @throws ServletException 
	 * ***/
	public void searchExpensesInfoList(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
		UserInfo  loginAdmin=this.getLoginAdmin(request);
		logger.info(loginAdmin.getLoginName()+"查询费用信息列表");
		
		String team=request.getParameter("team");
		String classifyName=request.getParameter("classifyName");
		String begin_generatedDate=request.getParameter("begin_generatedDate");
		String end_generatedDate=request.getParameter("end_generatedDate");
		String balanced=request.getParameter("balanced");
		
		request.setAttribute("team", team);
		request.setAttribute("classifyName", classifyName);
		request.setAttribute("begin_generatedDate", begin_generatedDate);
		request.setAttribute("end_generatedDate", end_generatedDate);
		request.setAttribute("balanced", balanced);
	 
		

		String orderSql=" order by CREATETIME desc";
		String whereSql=" where datastate!=3 ";
		
		
		//whereSql+=" and eid in (select t2.eid from  T_AAP_EXPENSEDETAILS t2 where t2.UID="+loginAdmin.getUid()+")";
		
		String urlParement="";
		if(team!=null&&!team.equals("")){ 
				whereSql+=" and TEAMID="+team;
				urlParement+="&team="+team;
		}
		
		if(classifyName!=null&&!classifyName.equals("")){
			whereSql+=" and CLASSIFYNAME like '%"+classifyName+"%'";
			urlParement+="&classifyName="+classifyName;
		}
		
		if(begin_generatedDate!=null&&!begin_generatedDate.equals("")){
			whereSql+=" and GENERATEDATE >='"+begin_generatedDate+"'";
			urlParement+="&begin_generatedDate="+begin_generatedDate;
		}
		
		if(end_generatedDate!=null&&!end_generatedDate.equals("")){
			whereSql+=" and GENERATEDATE <='"+end_generatedDate+"'";
			urlParement+="&end_generatedDate="+end_generatedDate;
		}
		if(balanced!=null&&!balanced.equals("")){
			whereSql+=" and BALANCED ="+balanced;
			urlParement+="&balanced="+balanced;
		}
		
		
		int currentPage = PaginatedList.getCurrentPage(request);
		int pageSize = PaginatedList.getPageSize(request);
		 
		PaginatedList paginatedList =this.selectPageData(pageSize, currentPage, whereSql, orderSql,ExpensesInfo.class);
		List<ExpensesInfo> expensesInfoList=paginatedList.getDataList();
		
		 
		for(ExpensesInfo expensesInfo:expensesInfoList){
			//查询详细信息
			String detailSql="select * from T_AAP_EXPENSEDETAILS t where t.eid="+expensesInfo.getEid();
			List<ExpensesDetailsInfo> detailsInfoList=this.selectList(detailSql, ExpensesDetailsInfo.class);
			expensesInfo.setDetailsList(detailsInfoList);
			 
		}
		
		 
		
		//查询组
		String teamSql="select * from T_AAP_TEAM t where t.TEAMUID="+loginAdmin.getUid()+" or t.id in (select t2.TEAMID from T_AAP_TEAMUSER t2 where t2.TUSERID="+loginAdmin.getUid()+")";
		List<TeamInfo> teamInfoList=this.selectList(teamSql, TeamInfo.class);
		request.setAttribute("teamInfoList", teamInfoList);
		
		request.setAttribute(Constants.PAGINATED_ACTION,"ExpensesInfoServlet.servlet?opt=searchExpensesInfoList"+urlParement);
		request.setAttribute("paginatedList", paginatedList);
		request.setAttribute("expensesInfoList", expensesInfoList);
		
		String path="/expensesInfo/expensesList.jsp";
		RequestDispatcher dispatcher = request.getRequestDispatcher(path);
		dispatcher .forward(request, response);
	}

	/**到新增团体费用*
	 * @throws IOException 
	 * @throws ServletException */
	public void toAddTeamData(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
		UserInfo  loginAdmin=this.getLoginAdmin(request);
		logger.info(loginAdmin.getLoginName()+"到新增团体费用页面");
		
		//查询组
		String teamSql="select * from T_AAP_TEAM t where t.TEAMUID="+loginAdmin.getUid()+" or t.id in (select t2.TEAMID from T_AAP_TEAMUSER t2 where t2.TUSERID="+loginAdmin.getUid()+")";
		List<TeamInfo> teamInfoList=this.selectList(teamSql, TeamInfo.class);
		request.setAttribute("teamInfoList", teamInfoList);
		
	 
		
		String path="/expensesInfo/addTeamExpenses.jsp";
		RequestDispatcher dispatcher = request.getRequestDispatcher(path);
		dispatcher .forward(request, response);
	}
	
	/**新增团体费用*
	 * @throws IOException 
	 * @throws ServletException */
	public void addTeamData(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
		UserInfo  loginAdmin=this.getLoginAdmin(request);
		logger.info(loginAdmin.getLoginName()+"新增一笔团体费用");
		
		 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
		 
		ExpensesInfo expensesInfo=new ExpensesInfo();
		String generatedDate=request.getParameter("generatedDate");//费用日期
		if(generatedDate!=null&&!generatedDate.equals("")){
			try {
				expensesInfo.setGeneratedDate(sdf.parse(generatedDate));
			} catch (ParseException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		String discription=request.getParameter("discription");//备注内容
		expensesInfo.setDiscription(discription);
		
		String classifyName=request.getParameter("classifyName");//分类名称
		expensesInfo.setClassifyName(classifyName); 
		
		expensesInfo.setBalanced(false);//是否结算
		
		String teamId=request.getParameter("team");//单笔费用信息所团体
		if(teamId!=null&&!teamId.equals("")){
			expensesInfo.setTeamId(new Integer(teamId));
		}
		
		expensesInfo.setDataState(1);//数据状态 草稿=1,正式=2,作废=3
		expensesInfo.setCreateTime(new Date());//创建时间
		expensesInfo.setCreateRuid(loginAdmin.getUid());//创建人
		expensesInfo.setLastModifyTime(new Date());//最后修改时间
		expensesInfo.setLastModifieRuid(loginAdmin.getUid());//最后修改人
		
		
		int  eid=this.addObjectInfo(expensesInfo);//分摊费用信息新增 返回ID
		
		ExpensesDetailsInfo expensesDetailsInfo=null;
		
		String [] cyrs=request.getParameterValues("cyr");//参与费用人员数组
		if(cyrs!=null){
			int countCyr=cyrs.length;//总参与人数
			double sumPay=0d;//所有人总支出
			for(String cyrUser:cyrs){
				String alreadyPay=request.getParameter("jeValue_"+cyrUser);
				if(alreadyPay!=null&&!alreadyPay.equals("")){
					sumPay+=new Double(alreadyPay);
				}
			}
			double avgShouldPay=sumPay/countCyr;//每人应该支出
			
			
			for(String cyrUser:cyrs){
				expensesDetailsInfo=new ExpensesDetailsInfo();//费用详细信息
				
				String alreadyPay=request.getParameter("jeValue_"+cyrUser);
				expensesDetailsInfo.setUid(new Integer(cyrUser));//人员ID
				expensesDetailsInfo.setEid(eid);//单笔分摊费用ID
				
				expensesDetailsInfo.setShouldPay(new BigDecimal(avgShouldPay));//应该支出费用
				if(alreadyPay!=null&&!alreadyPay.equals("")){
					expensesDetailsInfo.setAlreadyPay(new BigDecimal(alreadyPay));//已经支出的费用
					expensesDetailsInfo.setStillPay(new BigDecimal(avgShouldPay-new Double(alreadyPay)));//还要支出费用
				}
				
				expensesDetailsInfo.setExpensesType(1);//1为支出费用2为收入费用
				
				this.addObjectInfo(expensesDetailsInfo);//新增费用详细信息
			}
		}
		
		String path="ExpensesInfoServlet.servlet?opt=searchExpensesInfoList";
		response.sendRedirect(path);
	}
	
	
	
	/**到新增个人费用*
	 * @throws IOException 
	 * @throws ServletException */
	public void toAddIndividualData(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
		UserInfo  loginAdmin=this.getLoginAdmin(request);
		logger.info(loginAdmin.getLoginName()+"到新增个人费用页面");
	
		
		String path="/expensesInfo/addIndividualExpenses.jsp";
		RequestDispatcher dispatcher = request.getRequestDispatcher(path);
		dispatcher .forward(request, response);
	}
	
	
	/**新增个人费用*
	 * @throws IOException 
	 * @throws ServletException */
	public void addIndividualData(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
		UserInfo  loginAdmin=this.getLoginAdmin(request);
		logger.info(loginAdmin.getLoginName()+"新增一笔个人费用");
		
		 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
		 
		ExpensesInfo expensesInfo=new ExpensesInfo();
		String generatedDate=request.getParameter("generatedDate");//费用日期
		if(generatedDate!=null&&!generatedDate.equals("")){
			try {
				expensesInfo.setGeneratedDate(sdf.parse(generatedDate));
			} catch (ParseException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		String discription=request.getParameter("discription");//备注内容
		expensesInfo.setDiscription(discription);
		String classifyName=request.getParameter("classifyName");//分类名称
		expensesInfo.setClassifyName(classifyName); 
		expensesInfo.setBalanced(false);//是否结算
		expensesInfo.setTeamId(0);//0表示个人记录费用（不在任何团体）
		expensesInfo.setDataState(1);//数据状态 草稿=1,正式=2,作废=3
		expensesInfo.setCreateTime(new Date());//创建时间
		expensesInfo.setCreateRuid(loginAdmin.getUid());//创建人
		expensesInfo.setLastModifyTime(new Date());//最后修改时间
		expensesInfo.setLastModifieRuid(loginAdmin.getUid());//最后修改人
		
		
		int  eid=this.addObjectInfo(expensesInfo);//分摊费用信息新增 返回ID
		
		ExpensesDetailsInfo expensesDetailsInfo=new ExpensesDetailsInfo();//费用详细信息
		String alreadyPay=request.getParameter("jeValue");//付出费用金额
		expensesDetailsInfo.setUid(loginAdmin.getUid());//人员ID
		expensesDetailsInfo.setEid(eid);//单笔分摊费用ID
		if(alreadyPay!=null&&!alreadyPay.equals("")){
			expensesDetailsInfo.setShouldPay(new BigDecimal(alreadyPay));//应该支出费用
			expensesDetailsInfo.setAlreadyPay(new BigDecimal(alreadyPay));//已经支出的费用
			expensesDetailsInfo.setStillPay(new BigDecimal(0));//还要支出费用
		}
		expensesDetailsInfo.setExpensesType(1);//1为支出费用2为收入费用
				
		this.addObjectInfo(expensesDetailsInfo);//新增费用详细信息
		
		String path="ExpensesInfoServlet.servlet?opt=searchExpensesInfoList";
		response.sendRedirect(path);
	}

	/**删除一笔费用*
	 * @throws IOException 
	 * @throws ServletException */
	public void deleteSingleData(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
		UserInfo  loginAdmin=this.getLoginAdmin(request);
		
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
		String eid=request.getParameter("eid");//费用信息ID
		
		logger.info(loginAdmin.getLoginName()+"删除一笔费用,费用信息ID="+eid);
		
		if(eid!=null&&!eid.equals("")){
			ExpensesInfo expensesInfo=(ExpensesInfo) this.getObjectById(new Integer(eid), ExpensesInfo.class);
			if(expensesInfo!=null){
				expensesInfo.setDataState(3);////数据状态 草稿=1,正式=2,作废=3
			}
			this.updateObjectInfo(expensesInfo);
		}	
		
		String path="ExpensesInfoServlet.servlet?opt=searchExpensesInfoList";
		response.sendRedirect(path);
	}
	
	/**到修改一笔费用*
	 * @throws IOException 
	 * @throws ServletException */
	public void toUpdateSingleData(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
		UserInfo  loginAdmin=this.getLoginAdmin(request);
		
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
		String eid=request.getParameter("eid");//费用信息ID
		
		logger.info(loginAdmin.getLoginName()+"到修改一笔费用页面,费用信息ID="+eid);
		
		ExpensesInfo expensesInfo=null;
		if(eid!=null&&!eid.equals("")){
			expensesInfo=(ExpensesInfo) this.getObjectById(new Integer(eid), ExpensesInfo.class);
			
			//查询详细信息
			String detailSql="select * from T_AAP_EXPENSEDETAILS t where t.eid="+expensesInfo.getEid();
			List<ExpensesDetailsInfo> detailsInfoList=this.selectList(detailSql, ExpensesDetailsInfo.class);
			expensesInfo.setDetailsList(detailsInfoList);
			
			Map userValueMap=new HashMap();
			for(ExpensesDetailsInfo expensesDetailsInfo:detailsInfoList){
				userValueMap.put(expensesDetailsInfo.getUid(), expensesDetailsInfo.getAlreadyPay());
			}
			request.setAttribute("userValueMap", userValueMap);
			
			
			request.setAttribute("expensesInfo", expensesInfo);
		}	
		
		
		String path="ExpensesInfoServlet.servlet?opt=searchExpensesInfoList";
		if(expensesInfo!=null){
			if(expensesInfo.getTeamId()==0){//个人费用
				path="/expensesInfo/editIndividualExpenses.jsp";
				
			}else{ 
				
				//查询组
				String teamSql="select * from T_AAP_TEAM t where t.TEAMUID="+loginAdmin.getUid()+" or t.id in (select t2.TEAMID from T_AAP_TEAMUSER t2 where t2.TUSERID="+loginAdmin.getUid()+")";
				List<TeamInfo> teamInfoList=this.selectList(teamSql, TeamInfo.class);
				request.setAttribute("teamInfoList", teamInfoList);
				
				
				Integer teamId=expensesInfo.getTeamId();
				String whereSql=" where UID=(select tm.TEAMUID from T_AAP_TEAM tm where tm.id="+teamId+") or " +
					" UID in (select tmu.TUSERID from T_AAP_TEAMUSER tmu where tmu.TEAMID="+teamId+")";
				String orderSql="";
				List<UserInfo> userList=this.selectList(whereSql, orderSql, UserInfo.class);
				request.setAttribute("userList", userList);
				
				path="/expensesInfo/editTeamExpenses.jsp";
			}
		}
		
		
		RequestDispatcher dispatcher = request.getRequestDispatcher(path);
		dispatcher .forward(request, response);
	}
	
	
	/**修改个人费用*
	 * @throws IOException 
	 * @throws ServletException */
	public void editIndividualData(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
		UserInfo  loginAdmin=this.getLoginAdmin(request);
		logger.info(loginAdmin.getLoginName()+"修改一笔个人费用");
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
		 
		String eid=request.getParameter("eid");
		
		if(eid!=null&&!eid.equals("")){
				ExpensesInfo expensesInfo=(ExpensesInfo) this.getObjectById(new Integer(eid), ExpensesInfo.class);
				if(expensesInfo!=null){
						String generatedDate=request.getParameter("generatedDate");//费用日期
						if(generatedDate!=null&&!generatedDate.equals("")){
							try {
								expensesInfo.setGeneratedDate(sdf.parse(generatedDate));
							} catch (ParseException e) {
								// TODO Auto-generated catch block
								e.printStackTrace();
							}
						}
						String discription=request.getParameter("discription");//备注内容
						expensesInfo.setDiscription(discription);
						String classifyName=request.getParameter("classifyName");//分类名称
						expensesInfo.setClassifyName(classifyName); 
						//expensesInfo.setBalanced(false);//是否结算
						expensesInfo.setTeamId(0);//0表示个人记录费用（不在任何团体）
						expensesInfo.setDataState(1);//数据状态 草稿=1,正式=2,作废=3
						//expensesInfo.setCreateTime(new Date());//创建时间
						//expensesInfo.setCreateRuid(loginAdmin.getUid());//创建人
						expensesInfo.setLastModifyTime(new Date());//最后修改时间
						expensesInfo.setLastModifieRuid(loginAdmin.getUid());//最后修改人
						
						
						this.updateObjectInfo(expensesInfo);//修改分摊费用信息
						
						//查询详细信息
						String detailSql="select * from T_AAP_EXPENSEDETAILS t where t.eid="+expensesInfo.getEid();
						List<ExpensesDetailsInfo> detailsInfoList=this.selectList(detailSql, ExpensesDetailsInfo.class);
						if(detailsInfoList.size()>0){
							ExpensesDetailsInfo expensesDetailsInfo=detailsInfoList.get(0);//费用详细信息
							String alreadyPay=request.getParameter("jeValue");//付出费用金额
							//expensesDetailsInfo.setUid(loginAdmin.getUid());//人员ID
							//expensesDetailsInfo.setEid(eid);//单笔分摊费用ID
							if(alreadyPay!=null&&!alreadyPay.equals("")){
								expensesDetailsInfo.setShouldPay(new BigDecimal(alreadyPay));//应该支出费用
								expensesDetailsInfo.setAlreadyPay(new BigDecimal(alreadyPay));//已经支出的费用
								expensesDetailsInfo.setStillPay(new BigDecimal(0));//还要支出费用
							}
							expensesDetailsInfo.setExpensesType(1);//1为支出费用2为收入费用
									
							this.updateObjectInfo(expensesDetailsInfo);//新增费用详细信息
						}
				}
		}
		
		String path="ExpensesInfoServlet.servlet?opt=searchExpensesInfoList";
		response.sendRedirect(path);
	}
	
	
	
	
	/**修改团体费用*
	 * @throws IOException 
	 * @throws ServletException */
	public void editTeamData(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
		UserInfo  loginAdmin=this.getLoginAdmin(request);
		logger.info(loginAdmin.getLoginName()+"修改一笔团体费用");
		
		 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
		 
		 String eid=request.getParameter("eid");
			
			if(eid!=null&&!eid.equals("")){
					ExpensesInfo expensesInfo=(ExpensesInfo) this.getObjectById(new Integer(eid), ExpensesInfo.class);
					if(expensesInfo!=null){
		 
		 
									String generatedDate=request.getParameter("generatedDate");//费用日期
									if(generatedDate!=null&&!generatedDate.equals("")){
										try {
											expensesInfo.setGeneratedDate(sdf.parse(generatedDate));
										} catch (ParseException e) {
											// TODO Auto-generated catch block
											e.printStackTrace();
										}
									}
									String discription=request.getParameter("discription");//备注内容
									expensesInfo.setDiscription(discription);
									
									String classifyName=request.getParameter("classifyName");//分类名称
									expensesInfo.setClassifyName(classifyName); 
									
									expensesInfo.setBalanced(false);//是否结算
									
									String teamId=request.getParameter("team");//单笔费用信息所团体
									if(teamId!=null&&!teamId.equals("")){
										expensesInfo.setTeamId(new Integer(teamId));
									}
									
									expensesInfo.setDataState(1);//数据状态 草稿=1,正式=2,作废=3
									//expensesInfo.setCreateTime(new Date());//创建时间
									//expensesInfo.setCreateRuid(loginAdmin.getUid());//创建人
									expensesInfo.setLastModifyTime(new Date());//最后修改时间
									expensesInfo.setLastModifieRuid(loginAdmin.getUid());//最后修改人
									
									this.updateObjectInfo(expensesInfo);//修改分摊费用信息

									//团体费用修改  先删除原来的  再重新保存
									String detailSql="delete from T_AAP_EXPENSEDETAILS  where eid="+expensesInfo.getEid();
									this.executeSql(detailSql);//删除原来的
									
									
									
									ExpensesDetailsInfo expensesDetailsInfo=null;
									
									String [] cyrs=request.getParameterValues("cyr");//参与费用人员数组
									if(cyrs!=null){
										int countCyr=cyrs.length;//总参与人数
										double sumPay=0d;//所有人总支出
										for(String cyrUser:cyrs){
											String alreadyPay=request.getParameter("jeValue_"+cyrUser);
											if(alreadyPay!=null&&!alreadyPay.equals("")){
												sumPay+=new Double(alreadyPay);
											}
										}
										double avgShouldPay=sumPay/countCyr;//每人应该支出
										
										
										for(String cyrUser:cyrs){
											expensesDetailsInfo=new ExpensesDetailsInfo();//费用详细信息
											
											String alreadyPay=request.getParameter("jeValue_"+cyrUser);
											expensesDetailsInfo.setUid(new Integer(cyrUser));//人员ID
											expensesDetailsInfo.setEid(new Integer(eid));//单笔分摊费用ID
											
											expensesDetailsInfo.setShouldPay(new BigDecimal(avgShouldPay));//应该支出费用
											if(alreadyPay!=null&&!alreadyPay.equals("")){
												expensesDetailsInfo.setAlreadyPay(new BigDecimal(alreadyPay));//已经支出的费用
												expensesDetailsInfo.setStillPay(new BigDecimal(avgShouldPay-new Double(alreadyPay)));//还要支出费用
											}
											
											expensesDetailsInfo.setExpensesType(1);//1为支出费用2为收入费用
											
											this.addObjectInfo(expensesDetailsInfo);//新增费用详细信息
										}
									}
									
									
					}
			}
		
		String path="ExpensesInfoServlet.servlet?opt=searchExpensesInfoList";
		response.sendRedirect(path);
	}
	
	
	
	
	public void expensesInfoListIndexView(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
		UserInfo  loginAdmin=this.getLoginAdmin(request);
		logger.info(loginAdmin.getLoginName()+"首页显示费用信息");
		
		String orderSql=" order by CREATETIME desc";
		String whereSql=" where datastate!=3 ";
		//获取每页显示的行数  
        int pageSize=10;  
        if(null!=request.getParameter("rows")) {  
        	pageSize=Integer.parseInt(request.getParameter("rows").toString());  
        }  
        int currentPage=1;
        if(null!=request.getParameter("page")) {  
        	currentPage=Integer.parseInt(request.getParameter("page").toString());  
        }  
		 
		PaginatedList paginatedList =this.selectPageData(pageSize, currentPage, whereSql, orderSql,ExpensesInfo.class);
		List<ExpensesInfo> expensesInfoList=paginatedList.getDataList();
		Map loadFiledMap=new HashMap();
		loadFiledMap.put("teamName", "teamName");
		expensesInfoList=loadViewData(expensesInfoList,loadFiledMap);
		 
		
		 String data= paginatedList.getGridData();
			logger.info("获取费用信息数据"+data);
	        // set response header
	        response.setContentType("text/html;charset=UTF-8");  
	        response.setHeader("Cache-Control","no-cache");
	        // 写入json数据
	        try {
				response.getWriter().write(data);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
	}
	
	
	/**加载显示值**/
	public List<ExpensesInfo> loadViewData(List<ExpensesInfo> expensesInfoList,Map loadFiledMap){
		for(ExpensesInfo expensesInfo:expensesInfoList){
			if(loadFiledMap.containsKey("teamName")){
				if(expensesInfo.getTeamId()==0){
					expensesInfo.setTeamName("个 人");
				}else{
					TeamInfo teamInfo=(TeamInfo) this.getObjectById(expensesInfo.getTeamId(), TeamInfo.class);
					if(teamInfo!=null){
						expensesInfo.setTeamName(teamInfo.getTeamName());
					}
				}
			}
			
		}
		return expensesInfoList;
	}
	

}
